package LeetCode;

public class LC_492_ConstructtheRectangle {

    public static void main(String[] args) {

    }

    public class Solution {
        public int[] constructRectangle(int area) {
            int[] res = new int[2];
            int w = 0;
            int l = 0;
            for (int i = 1; i <= (int) Math.sqrt(area); i++) {
                if (area % i == 0) {
                    w = i;
                    l = area / i;
                }
            }
            res[0] = l;
            res[1] = w;
            return res;
        }

    }
}